package com.lx.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class test {
    public static void main(String[] args) {
        String regex2 = "[0][1-9][0-9]-\\d{7}";
        System.out.println("022-1234567".matches(regex2));
        String str = "java17是java18是java20";
//        获取java18,java17,java20的前半部分
        String regex = "java(?=17|18|20)";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(str);
        while(m.find())
        {
            System.out.println(m.group());
        }
    }
}
